\documentclass[paper=a4, fontsize=11pt]{scrartcl} % A4 paper and 11pt font size

\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\usepackage{fourier} % Use the Adobe Utopia font for the document - comment this line to return to the LaTeX default
\usepackage[english]{babel} % English language/hyphenation
\usepackage{amsmath,amsfonts,amsthm} % Math packages
\usepackage[UTF8]{ctex}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{tikz}
\usepackage{lipsum} % Used for inserting dummy 'Lorem ipsum' text into the template
\usepackage{clrscode}
\usepackage{sectsty} % Allows customizing section commands
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{float}
\usetikzlibrary{graphs}
\usetikzlibrary{shapes.arrows}
\allsectionsfont{\centering \normalfont\scshape} % Make all sections centered, the default font and small caps

\usepackage{fancyhdr} % Custom headers and footers
\pagestyle{fancyplain} % Makes all pages in the document conform to the custom headers and footers
\fancyhead{} % No page header - if you want one, create it in the same way as the footers below
\fancyfoot[L]{} % Empty left footer
\fancyfoot[C]{} % Empty center footer
\fancyfoot[R]{\thepage} % Page numbering for right footer
\renewcommand{\headrulewidth}{0pt} % Remove header underlines
\renewcommand{\footrulewidth}{0pt} % Remove footer underlines
\setlength{\headheight}{13.6pt} % Customize the height of the header

\numberwithin{equation}{section} % Number equations within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{figure}{section} % Number figures within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)
\numberwithin{table}{section} % Number tables within sections (i.e. 1.1, 1.2, 2.1, 2.2 instead of 1, 2, 3, 4)

\setlength\parindent{0pt} % Removes all indentation from paragraphs - comment this line for an assignment with lots of text

%----------------------------------------------------------------------------------------
%	TITLE SECTION
%----------------------------------------------------------------------------------------

\newcommand{\horrule}[1]{\rule{\linewidth}{#1}} % Create horizontal rule command with 1 argument of height

\title{
\normalfont \normalsize
\textsc{中国科学院大学}\ \textsc{计算机与控制学院} \\ [25pt] % Your university, school and/or department name(s)
\horrule{0.5pt} \\[0.4cm] % Thin top horizontal rule
\huge 矩阵应用与分析第六次作业 \\ % The assignment title
\horrule{2pt} \\[0.5cm] % Thick bottom horizontal rule
}

\author{黎吉国&201618013229046} % Your name

\date{\normalsize\today} % Today's date or a custom date

\begin{document}

\maketitle % Print the title
\newpage
\section{answer for 1st}
using Householder reduction and Givens reduction, compute the QR facrors of
\[
A=\left (
\begin{array}{rrr}
  1&19&-34\\
  -2 & -5 &20\\
  2 &8 &37
\end{array}
\right)
\]

\textbf{Solution:}\\
\begin{enumerate}
  \item Householder
  \begin{enumerate}
    \item for firat cloumn
    \[
    \begin{split}
    u_1&=A_{*1}-\| A_{*1}\|e_1=(-2\ -2\ 2)^T\\
    R_1&=I-2\frac{u_1 u_1^T}{u_1^T u_1}=\frac{2}{3}
    \left(
    \begin{array}{rrr}
      \frac{1}{2}&-1&1\\
      -1&\frac{1}{2}&1\\
      1&1&\frac{1}{2}
    \end{array}
    \right)\\
    R_1A_{*1}&= \|A_{*1}\|e_1=(3\ 0\ 0)^T\\
    R_1 A_{*2}&= (15\ -9 \ 12)^T\\
    R_1 A_{*3}&= (0\ 54\ 3)^T\\
    R_1 A&=\left(
    \begin{array}{rrr}
      3&15&0\\
      0&-9&54\\
      0&12&3
    \end{array}
    \right)
  \end{split}
    \]
    \item for the second cloumn
    \[
    \begin{split}
      A_2&=\left(
      \begin{array}{rr}
      -9&54\\
      12&3
    \end{array}
      \right)\\
      u_2&=[A_2]_{*1}-\| [A_2]_{*1} \|e_1=12(-2\ 1)^T\\
      \hat{R_2}&= I-2\frac{u_2 u_2^T}{u_2^T u}=\frac{1}{5}\left(
      \begin{array}{rr}
      -3&4\\
      4&3
    \end{array}
      \right)\\
      \hat{R_2}[A_2]_{*1}&=(15\ 0)^T\\
      \hat{R_2}[A_2]_{*2}&=(-30\ 45)^T\\
      \hat{R_2}A_2 &= \left(
      \begin{array}{rr}
        15&-30\\
        0&45
      \end{array}
      \right)\\
      R_2&=\left(
      \begin{array}{rr}
        1&0\\
        0&\hat{R_2}
      \end{array}
      \right)=\left(
      \begin{array}{rrr}
        3&15&0\\
        0&15&-30\\
        0&0&45
      \end{array}
      \right)\\
      R&=R_1*R_2=\left(
      \begin{array}{rrr}
        1/3 & 14/15 & -2/15\\
        -2/3 & 1/3 & 2/3\\
        2/3 & -2/15& 11/15
      \end{array}
      \right)\\
      RA&= \left(
      \begin{array}{rrr}
        3&15&0\\
        0&15&-30\\
        0&0&45
      \end{array}
      \right)
    \end{split}
    \]
  \end{enumerate}
  \item Givens
  \begin{enumerate}
    \item for the first cloumn, eliminate $A_{21}$
    \[
    \begin{split}
      c_1&=\frac{A_{11}}{\sqrt{A_{11}^2+A_{21}^2}}=\frac{1}{\sqrt{5}}\\
      s_1&=\frac{A_{21}}{\sqrt{A_{11}^2+A_{21}^2}}=\frac{2}{\sqrt{5}}\\
      T_1&=\left(
      \begin{array}{rrr}
      c_1&s_1&0\\
      -s_1&c_1&0\\
      0&0&1
    \end{array}
      \right)=\left(
      \begin{array}{rrr}
      \frac{1}{\sqrt{5}}&-\frac{2}{\sqrt{5}}&0\\
      \frac{2}{\sqrt{5}}&\frac{1}{\sqrt{5}}&0\\
      0&0&1
    \end{array}
      \right)\\
      A_2&=T_1 A_1=\left(
      \begin{array}{rrr}
        \sqrt{5}&\frac{29}{\sqrt{5}}&\frac{-74}{\sqrt{5}}\\
        0&\frac{33}{\sqrt{5}}&\frac{-48}{\sqrt{5}}\\
        2&8&37
      \end{array}
      \right)
    \end{split}
    \]
    \item for the first cloumn, eliminate $A_{31}$
    \[
    \begin{split}
    c_2&=\frac{\sqrt{A_{11}^2+A_{21}^2}}{\sqrt{A_{11}^2+A_{21}^2}+A_{31}^2}=\frac{\sqrt{5}}{3} \\
    s_2&=\frac{A_{31}}{\sqrt{A_{11}^2+A_{21}^2}+A_{31}^2}=\frac{2}{3}\\
    T_2&=\left(
    \begin{array}{rrr}
      c_2&0&s_2\\
      0&1&0\\
      -s_2&0&c_2
    \end{array}
    \right)=\left(
    \begin{array}{rrr}
    \frac{\sqrt{5}}{3}&0&\frac{2}{3}\\
    0&1&0\\
    -\frac{2}{3}&0&\frac{\sqrt{5}}{3}
  \end{array}
    \right)\\
    A_3&=T_2A_2=\left(
    \begin{array}{rrr}
      3&15&0\\
      0&\frac{33}{\sqrt{5}}&\frac{-48}{\sqrt{5}}\\
      0&\frac{-6}{\sqrt{5}}&\frac{111}{\sqrt{5}}
    \end{array}
    \right)
  \end{split}
    \]
    \item for the second cloumn, eliminate $A_{32}$
    \[
    \begin{split}
      c_3&=\frac{[A_3]_{22}}{\sqrt{[A_3]_{22}^T+[A_3]_{32}^2}}=\frac{11}{5\sqrt{5}}\\
      s_3&=\frac{[A_3]_{32}}{\sqrt{[A_3]_{22}^T+[A_3]_{32}^2}}=\frac{-2}{5\sqrt{5}}\\
      T_3&=\left(
      \begin{array}{rrr}
        1&0&0\\
        0&c_3&s_3\\
        0&-s_3&c_3
      \end{array}
      \right)=\left(
      \begin{array}{rrr}
        1&0&0\\
        0&\frac{11}{5\sqrt{5}}&\frac{-2}{5\sqrt{5}}\\
        0&\frac{2}{5\sqrt{5}}&\frac{11}{5\sqrt{5}}
      \end{array}
      \right)\\
      A_4&=T_3 A_3=\left(
      \begin{array}{rrr}
        3&15&0\\
        0&15&-30\\
        0&0&45
      \end{array}
      \right)\\
      T&=T_1 T_2 T_3=\left(
      \begin{array}{rrr}
        1/3 & 14/15 & -2/15\\
        -2/3 & 1/3 & 2/3\\
        2/3 & -2/15& 11/15
      \end{array}
      \right)\\
      TA&=\left(
      \begin{array}{rrr}
        3&15&0\\
        0&15&-30\\
        0&0&45
      \end{array}
      \right)
    \end{split}
    \]
  \end{enumerate}
\end{enumerate}

\newpage
\section{answer for 7th}
Let $\mathcal{X}$ and $\mathcal{y}$ be subspace of $\mathcal{R}^3$ whose respective bases autolinebreaks
\[
\mathcal{B}_{\mathcal{x}}=\left\{
\left(
\begin{array}{r}
  1\\ 1\\ 1
\end{array}
\right),\left(
\begin{array}{r}
  1\\ 2\\ 2
\end{array}
\right)
\right\}
\ and \
\mathcal{B}_{\mathcal{y}}=\left\{
\left(
\begin{array}{r}
1\\ 2\\ 3
\end{array}
\right)
\right\}
\]
\begin{enumerate}
  \item Explain why $\mathcal{x}$ and $\mathcal{y}$ are complementary subspace of $\mathcal{R}^3$.
  \item Determine the projector P on $\mathcal{x}$ along $\mathcal{y}$ as well as the complementary projector Q onto $\mathcal{y}$ along $\mathcal{x}$.
  \item Determine the projector of $v=(2\ -1\ 1)^T$ onto $\mathcal{y}$ along $\mathcal{x}$.
\end{enumerate}
\textbf{Solution:}\\
\begin{enumerate}
  \item $rank(\mathcal{B}_{\mathcal{x}}|\mathcal{B}_\mathcal{y})=3$,so $\mathcal{x} and \mathcal{y}$ is complementary subspace.
  \item
  \[
  \begin{split}
  P&=[\mathcal{B}_{\mathcal{x}|0}][\mathcal{B}_{\mathcal{x}}|\mathcal{B}_{\mathcal{y}}]^{-1}=
  \left(
  \begin{array}{rrr}
    1&1&-1\\
    0&3&-2\\
    0&3&-2
  \end{array}
  \right)\\
  Q&=[0|\mathcal{B}_{\mathcal{y}}][\mathcal{B}_{\mathcal{x}}|\mathcal{B}_{\mathcal{y}}]^{-1}=\left(
  \begin{array}{rrr}
    0&-1&1\\
    0&-2&2\\
    0&-3&3
  \end{array}
  \right)
\end{split}
  \]
  \item
  \[
  Qv=
  \begin{pmatrix}
    0&-1&1\\
    0&-2&2\\
    0&-3&3
  \end{pmatrix}
  \begin{pmatrix}
    2\\ -1\\ 1
  \end{pmatrix}
  =2
  \begin{pmatrix}
    1\\ 2\\ 3
  \end{pmatrix}
  \]
\end{enumerate}
\end{document}
